<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>语法糖</title>
</head>
<body>
  <div id="app">
    {{message}}
    全局组件<cpn1></cpn1>
    <hr>
    局部组件<cpn2></cpn2>
  </div>
  <script src="../js/vue.js"></script>
  <script>
    //1.创建组件构造器
    //2.注册组件
    //语法糖合并了1，2
    Vue.component('cpn1',{
      template: `
        <div>
          <h2>我是标题</h2>
          <p>我是内容，哈哈哈哈</p>
        </div>`
    })

    const app = new Vue({
      el:'#app',
      data: {
        message: '你好啊啊'
      },
      components: {
        'cpn2': {
          template: `
            <div>
              <h2>我是标题</h2>
              <p>我是内容，哈哈哈哈</p>
            </div>`
        }
      }
    })
  </script>
  
</body>
</html>